package com.health.ts.service.datasource;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.health.ts.dao.sysmanage.SysDictMapper;
import com.health.ts.entity.sysmanage.SysDict;


@Service
@DS("master")
public class MasterDataService {
	
	@Autowired
	SysDictMapper sysDictMapper;
	
	/**
	 * 测试查询
	 * @return
	 */
	public List<SysDict> testQuery(){
		QueryWrapper<SysDict> wrapper = new QueryWrapper<SysDict>();
		wrapper.eq("valid_status", "1");
		return sysDictMapper.selectList(wrapper);
	}
	
	/**
	 * 方法上没有加数据源注解 默认使用类上的数据源
	 * @return
	 */
	public void testSave(){
		SysDict dict = SysDict.builder().id("200").group_code("test").group_name("测试").item_code("1").item_name("测试1")
				.item_order(1).build();
		sysDictMapper.insert(dict);
	}
}
